//
//  YuLoginInputInfoField.m
//  HuLaQuan
//
//  Created by hok on 1/8/16.
//  Copyright © 2016 Jianghao. All rights reserved.
//

#import "YuLoginInputInfoField.h"


@implementation YuLoginInputInfoField


- (void)drawRect:(CGRect)rect {

    
    
}
- (instancetype)initWithCoder:(NSCoder *)aDecoder
{
    self = [super initWithCoder:aDecoder];
    if (self) {
        CGRect frame = [self frame];
        frame.size.width = 20.0f;
        UIView *leftview = [[UIView alloc] initWithFrame:frame];
        self.leftViewMode = UITextFieldViewModeAlways;
        self.leftView = leftview;
        
        
        self.tintColor = UIColorFromRGBA(kMainTextGrayColor,1.0);
        
        self.textColor = UIColorFromRGBA(kMainTextGrayColor,1.0);
        
        
        self.font = [UIFont fontWithName:FONT_NAME size:15];
    }
    return self;
}


- (void)setImageName:(NSString *)imageName
{
    _imageName = imageName;
    
    CGRect frame = [self frame];
    frame.size.width = 65.0f;
    UIView *leftview = [[UIView alloc] initWithFrame:frame];
    UIImageView *img = [[UIImageView alloc] initWithImage:[UIImage imageNamed:_imageName]];

    [img setFrame:CGRectMake((42- SCALE_FOR_SCREEN(img.bounds.size.width))/2, (self.bounds.size.height- SCALE_FOR_SCREEN(img.bounds.size.height))/2, SCALE_FOR_SCREEN(img.bounds.size.width), SCALE_FOR_SCREEN(img.bounds.size.height))];
    [leftview addSubview:img];
    self.leftViewMode = UITextFieldViewModeAlways;
    self.leftView = leftview;
    
    
}
- (void)setColorfulPlaceholder:(NSString *)placeholder;
{
    UIColor *color = UIColorFromRGBA(kMainTextGrayColor,1.0);
    self.attributedPlaceholder = [[NSAttributedString alloc] initWithString:placeholder attributes:@{NSForegroundColorAttributeName: color}];
}
- (void)awakeFromNib
{
    [super awakeFromNib];
    

    self.contentVerticalAlignment = UIControlContentVerticalAlignmentCenter;
    
    self.layer.cornerRadius = 3.0;
    self.layer.masksToBounds = YES;
    self.layer.borderWidth = 1.0;
    self.layer.borderColor = [UIColorFromRGBA(kTableViewSplitLineColor,1.0) CGColor];
    
}
@end
